package org.digitarts.rtms.spring.collectors.collections;

import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashSet;

public class InitableHashSet<E> extends HashSet<E>
{

	private static final long		serialVersionUID	= 7841473060287741041L;
	public static final Class<?>[]	NULL_SIG			= new Class[] {};
	public static final Object[]	NULL_PARAMS			= new Object[] {};

	public void init()
	{
		for (E e : this)
		{
			try
			{
				Method m = e.getClass().getMethod("init", NULL_SIG);
				m.invoke(e, NULL_PARAMS);
			}
			catch (Exception ex)
			{
			}
		}
	}

	public InitableHashSet(Collection<? extends E> c)
	{
		super(c);
	}

}
